package com.yanqu.road.server.cmd.activity.peakseacraft;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.PeakSeacraftProto;
import com.yanqu.road.pb.activity.SeacraftSouthSeaProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.peakseacraft.PeakSeacraftMgr;
import com.yanqu.road.server.manager.activity.seacraftsouthsea.SeacraftSouthSeaMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

import java.util.List;

@Cmd(code = CrossProtocol.C_PEAK_SEACRAFT_SYN_PROMOTION_UNION, desc = "海上争霸 南海丝路 同步晋级的联盟数据")
public class CrossPeakSeacraftSynPromotionUnionCmd extends CrossUnionCommand {

    int activityId;
    List<PeakSeacraftProto.PeakSeacraftUnionInfo> unionInfoList;
    List<PeakSeacraftProto.PeakSeacraftLockUserInfo> userTeamInfoList;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        PeakSeacraftProto.PeakSeacraftSynPromotionUnionGameToCrossMsg builder = PeakSeacraftProto.PeakSeacraftSynPromotionUnionGameToCrossMsg.parseFrom(packet.getBytes());
        activityId = builder.getActivityId();
        unionInfoList = builder.getUnionListList();
        userTeamInfoList = builder.getUserTeamInfoListList();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        PeakSeacraftMgr.synPromotionUnion(activityId, unionInfoList,userTeamInfoList, groupId);
    }

    @Override
    public void sendData() {

    }
}
